<!DOCTYPE HTML>
<html>
 <head>
  <title>标签管理</title>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
       <link href="../assets/css/dpl-min.css" rel="stylesheet" type="text/css" />
    <link href="../assets/css/bui-min.css" rel="stylesheet" type="text/css" />
    <link href="../assets/css/page-min.css" rel="stylesheet" type="text/css" /> 
 </head>
 <body>
  
  <div class="container">

    <div class="row header">
      <p>标签管理</p>
      <span class="headBtn"><a id="label_1" href="#">新增标签</a></span>
    </div>

        <!-- 此部分是新增标签弹出的提示框 -->
     <div class="bgg" style="display: none"></div>
     <div id="prompt_msg14" class="pop_main" style="display: none;">
       <div id="prompt_title" class="pop_title">新增标签</div>
          <div class="pop_content clearfix">
               <div class="pop_content01">
                <label for="">有效期：</label>
                <input type="text" class=" calendar" name="startDate"><span> - </span><input name="endDate" type="text" class=" calendar">
              </div>
              <div class="pop_content01">
                <label for="">使用条件：</label>
                <span>满</span>
                <input type="text">
                <span>元起使用</span>
              </div>
              <div class="pop_content01">
                 <label for="">描述</label>
                 <textarea id="addTextarea" name="" id="" cols="50" rows="10"></textarea>
              </div>
          </div>
          <div class="clearfix twoBtn">
             <div id="dlg-sure14" class="btn_style_1 pop_btn1">确定</div>
             <div id="dlg-close14" class="btn_style_1 pop_btn2">取消</div>
          </div>
        </div><!-- 提示框结束 --> 


      <!-- 此部分是创建活动弹出的提示框 -->
     <div id="prompt_msg15" class="pop_main" style="display: none">
       <div id="prompt_title" class="pop_title">添加/编辑等级</div>
          <div class="pop_content clearfix">
              <div class="pop_content01">
                <label for=""><input type="radio" name="gift01" />折扣</label>
                <input type="text">
              </div>
              <div class="pop_content01">
                <label for=""><input type="radio" name="gift01" />减现：</label>
                <input type="text">
              </div>
              <div class="pop_content01">
                <label for=""><input type="radio" name="gift01" />包邮：</label>
                <input type="text">
                <span>元</span>
              </div>
              <div class="pop_content01">
                <label for="">有效期：</label>
                <input type="text" class=" calendar" name="startDate"><span> - </span><input name="endDate" type="text" class=" calendar">
              </div>
              <div class="pop_content01">
                <label for="">使用条件：</label>
                <span>满</span>
                <input type="text">
                <span>元起使用</span>
              </div>
          </div>
          <div class="clearfix twoBtn">
             <div id="dlg-sure15" class="btn_style_1 pop_btn1">确定</div>
             <div id="dlg-close15" class="btn_style_1 pop_btn2">取消</div>
          </div>
      </div><!-- 提示框结束 -->

     <!-- 此部分是复制弹出的提示框 -->
     <div id="prompt_msg16" class="pop_main" style="display: none;width:420px;">
       <div id="prompt_title" class="pop_title">复制到</div>
          <div class="pop_content popContent02 clearfix">
              <div class="pop_content01">
                <label for="">从</label>
                <select name="" id="">
                  <option value=""></option>
                  <option value=""></option>
                </select>
                <label for="">复制到</label>
                <select name="" id="">
                  <option value=""></option>
                  <option value=""></option>
                </select>
              </div>  
          </div>
          <div class="clearfix twoBtn">
             <div id="dlg-sure16" class="btn_style_1 pop_btn1">确定</div>
             <div id="dlg-close16" class="btn_style_1 pop_btn2">取消</div>
          </div>
        </div><!-- 提示框结束 --> 

         <!-- 此部分是移动弹出的提示框 -->
     <div id="prompt_msg17" class="pop_main" style="display: none;width:420px;">
       <div id="prompt_title" class="pop_title">移动到</div>
          <div class="pop_content popContent02 clearfix">
              <div class="pop_content01">
                <label for="">从</label>
                <select name="" id="">
                  <option value=""></option>
                  <option value=""></option>
                </select>
                <label for="">移动到</label>
                <select name="" id="">
                  <option value=""></option>
                  <option value=""></option>
                </select>
              </div>  
          </div>
          <div class="clearfix twoBtn">
             <div id="dlg-sure17" class="btn_style_1 pop_btn1">确定</div>
             <div id="dlg-close17" class="btn_style_1 pop_btn2">取消</div>
          </div>
        </div><!-- 提示框结束 --> 
    <div class="row fileborder">

          <div class="control-group span4" >
              <input type="text" placeholder="标签名称"/>
          </div>
          <div class="span3 offset2">
            <span class="myspanBtn">搜索</span>
          </div>
          <div class="span3 offset2">
            <span id="setUpActi" class="myspanBtn">创建活动</span>
          </div>
    </div>

    <div class="search-grid-container">
       <div id="grid"></div>
    </div>
  </div>


  <script type="text/javascript" src="../assets/js/jquery-1.8.1.min.js"></script>
  <script type="text/javascript" src="../assets/js/bui-min.js"></script>
  <script type="text/javascript" src="../assets/js/config-min.js"></script>
    <script type="text/javascript" src="../assets/js/myjs.js"></script>
  <script type="text/javascript">
    BUI.use('common/page');
  </script>

<script type="text/javascript">
  BUI.use('common/search',function (Search) {
   
        var  editing = new BUI.Grid.Plugins.DialogEditing({
        contentId : 'content', //设置隐藏的Dialog内容
        autoSave : true, //添加数据或者修改数据时，自动保存
        triggerCls : 'btn-edit'
      }),
      columns = [
          {title:'标签名称',dataIndex:'member-5-1',width:200},
          {title:'描述',dataIndex:'member-5-2',width:200},
          {title:'会员数',dataIndex:'member-5-3',width:200},
          {title:'操作',dataIndex:'',width:500,renderer : function(value,obj){ 
              var editStr1 = '<span class="grid-command" title=""><a href="">[查看会员]</a></span>',
              editStr2 = '<span class="grid-command" id="copy_1" title="">[复制到]</span>',
              editStr3 = '<span id="move_1" class="grid-command" title="">[移动到]</span>',
              delStr = '<span class="grid-command btn-del" >[移除]</span>';//页面操作不需要使用Search.createLink
            return   editStr1 + editStr2 + editStr3 + delStr;
          }}
        ],
      store = Search.createStore('../data/goods03.json',{
        proxy : {
          save : { //也可以是一个字符串，那么增删改，都会往那么路径提交数据，同时附加参数saveType
            addUrl : '../data/add.json',
            updateUrl : '../data/edit.json',
            removeUrl : '../data/del.php'
          }/*,
          method : 'POST'*/
        },
        autoSync : true //保存数据后，自动更新
      }),
      gridCfg = Search.createGridCfg(columns,{
       
        plugins : [editing,BUI.Grid.Plugins.CheckSelection,BUI.Grid.Plugins.AutoFit] // 插件形式引入多选表格
      });
    var  search = new Search({
        store : store,
        gridCfg : gridCfg
      }),
      grid = search.get('grid');

    function addFunction(){
      var newData = {isNew : true}; //标志是新增加的记录
      editing.add(newData,'name'); //添加记录后，直接编辑
    }

    //删除操作
    function delFunction(){
      var selections = grid.getSelection();
      delItems(selections);
    }

    function delItems(items){
      var ids = [];
      BUI.each(items,function(item){
        ids.push(item.id);
      });

      if(ids.length){
        BUI.Message.Confirm('确认要删除选中的记录么？',function(){
          store.save('remove',{ids : ids});
        },'question');
      }
    }

   // 监听事件，删除一条记录
    grid.on('cellclick',function(ev){
      var sender = $(ev.domTarget); //点击的Dom
      if(sender.hasClass('btn-del')){
        var record = ev.record;
        delItems([record]);
      }
    });
  });
</script>

</body>
</html>  
 
